#pragma once
#include <CommonLib/Math/Vec3.h>

namespace fastbird
{
	//-------------------------------------------------------------------------
	template<class T>
	inline  T Random(T min, T max)
	{
		T k = max - min;
		T offset = (T)(((float)std::rand() / (float)RAND_MAX) * (float)k);
		T result = min + offset;
		return result;
	}

	inline Vec3 Random(const Vec3& min, const Vec3& max) 
	{
		return Vec3(Random(min.x, max.x),
			Random(min.y, max.y),
			Random(min.z, max.z));
	};

	//-------------------------------------------------------------------------
	template<class T>
	class Randomizer
	{
	public:
		Randomizer(T min, T max)
		{
			mMin = min;
			mMax = max;
		}
		T Get(T value)
		{
			T factor = Random(mMin, mMax);
			return value + factor;

		}

	private:
		T mMin;
		T mMax;
	};
}